zynqmp: pm: Provide state argument to the pm_self_suspend API call
authorFilip Drazic <[email protected]>
Wed, 20 Jul 2016 15:17:39 +0000 (17:17 +0200)
committerSoren Brinkmann <[email protected]>
Tue, 13 Sep 2016 16:19:03 +0000 (09:19 -0700)
The state argument of the pm_self_suspend API encodes the state to
which the APU intends to suspend. The state can be:
- PM_APU_STATE_CPU_IDLE - processor power down, all memories remain
  on
- PM_APU_STATE_SUSPEND_TO_RAM - all processors powered down, L2$
  powered down, all OCM banks in retention and DDR in
  self-refresh.
The calls for setting requirements for L2$ and OCM banks are now
redundant and removed.

Signed-off-by: Filip Drazic <[email protected]>
[ sb
 - remove redundant #defines
]
Signed-off-by: Sören Brinkmann <[email protected]>
plat/xilinx/zynqmp/plat_psci.c
plat/xilinx/zynqmp/pm_service/pm_api_sys.c
plat/xilinx/zynqmp/pm_service/pm_client.c
plat/xilinx/zynqmp/pm_service/pm_defs.h

index f0e260dea927553541b065f4433eb0241a0b814c..472adfb76809840052e45b0f18016aab49635c39 100644 (file)
@@ -147,7 +147,7 @@ static void zynqmp_pwr_domain_off(const psci_power_state_t *target_state)
         * invoking CPU_on function, during which resume address will
         * be set.
         */
-       pm_self_suspend(proc->node_id, MAX_LATENCY, 0, 0);
+       pm_self_suspend(proc->node_id, MAX_LATENCY, PM_STATE_CPU_IDLE, 0);
 }
 
 static void zynqmp_nopmu_pwr_domain_suspend(const psci_power_state_t *target_state)
@@ -179,6 +179,7 @@ static void zynqmp_nopmu_pwr_domain_suspend(const psci_power_state_t *target_sta
 
 static void zynqmp_pwr_domain_suspend(const psci_power_state_t *target_state)
 {
+       unsigned int state;
        unsigned int cpu_id = plat_my_core_pos();
        const struct pm_proc *proc = pm_get_proc(cpu_id);
 
@@ -186,15 +187,14 @@ static void zynqmp_pwr_domain_suspend(const psci_power_state_t *target_state)
                VERBOSE("%s: target_state->pwr_domain_state[%lu]=%x\n",
                        __func__, i, target_state->pwr_domain_state[i]);
 
+       state = target_state->pwr_domain_state[1] > PLAT_MAX_RET_STATE ?
+               PM_STATE_SUSPEND_TO_RAM : PM_STATE_CPU_IDLE;
+
        /* Send request to PMU to suspend this core */
-       pm_self_suspend(proc->node_id, MAX_LATENCY, 0, zynqmp_sec_entry);
+       pm_self_suspend(proc->node_id, MAX_LATENCY, state, zynqmp_sec_entry);
 
        /* APU is to be turned off */
        if (target_state->pwr_domain_state[1] > PLAT_MAX_RET_STATE) {
-               /* Power down L2 cache */
-               pm_set_requirement(NODE_L2, 0, 0, REQ_ACK_NO);
-               /* Send request for OCM retention state */
-               set_ocm_retention();
                /* disable coherency */
                plat_arm_interconnect_exit_coherency();
        }
index eac7801b058d5d103c3fe92452700702b3c915da..f78a3113d360c38b3452b9f2173aaad3032025b0 100644 (file)
@@ -76,7 +76,7 @@
  * pm_self_suspend() - PM call for processor to suspend itself
  * @nid                Node id of the processor or subsystem
  * @latency    Requested maximum wakeup latency (not supported)
- * @state      Requested state (not supported)
+ * @state      Requested state
  * @address    Resume address
  *
  * This is a blocking call, it will return only once PMU has responded.
index cf0d5f08d3607cf83e6efae364c5a49186d983d4..f0b34cbbe174cb5f8020bf18adab2801d43ea78f 100644 (file)
 #include "pm_ipi.h"
 #include "../zynqmp_def.h"
 
-#define OCM_BANK_0     0xFFFC0000
-#define OCM_BANK_1     (OCM_BANK_0 + 0x10000)
-#define OCM_BANK_2     (OCM_BANK_1 + 0x10000)
-#define OCM_BANK_3     (OCM_BANK_2 + 0x10000)
-
 #define UNDEFINED_CPUID                (~0)
+
 DEFINE_BAKERY_LOCK(pm_client_secure_lock);
 
-/* Declaration of linker defined symbol */
-extern unsigned long __BL31_END__;
 extern const struct pm_ipi apu_ipi;
 
 /* Order in pm_procs_all array must match cpu ids */
@@ -79,38 +73,6 @@ static const struct pm_proc const pm_procs_all[] = {
        },
 };
 
-/**
- * set_ocm_retention() - Configure OCM memory banks for retention
- *
- * APU specific requirements for suspend action:
- * OCM has to enter retention state in order to preserve saved
- * context after suspend request. OCM banks are determined by
- * __BL31_END__ linker symbol.
- *
- * Return:     Returns status, either success or error+reason
- */
-enum pm_ret_status set_ocm_retention(void)
-{
-       enum pm_ret_status ret;
-
-       /* OCM_BANK_0 will always be occupied */
-       ret = pm_set_requirement(NODE_OCM_BANK_0, PM_CAP_CONTEXT, 0,
-                                REQ_ACK_NO);
-
-       /* Check for other OCM banks  */
-       if ((unsigned long)&__BL31_END__ >= OCM_BANK_1)
-               ret = pm_set_requirement(NODE_OCM_BANK_1, PM_CAP_CONTEXT, 0,
-                                        REQ_ACK_NO);
-       if ((unsigned long)&__BL31_END__ >= OCM_BANK_2)
-               ret = pm_set_requirement(NODE_OCM_BANK_2, PM_CAP_CONTEXT, 0,
-                                        REQ_ACK_NO);
-       if ((unsigned long)&__BL31_END__ >= OCM_BANK_3)
-               ret = pm_set_requirement(NODE_OCM_BANK_3, PM_CAP_CONTEXT, 0,
-                                        REQ_ACK_NO);
-
-       return ret;
-}
-
 /**
  * pm_get_proc() - returns pointer to the proc structure
  * @cpuid:     id of the cpu whose proc struct pointer should be returned
index a8921e7bdf74529c9a785b159aae41b31c145cd2..7bbfec858d46cc07fb80e9efc880379bce4b021b 100644 (file)
 #define MAX_LATENCY    (~0U)
 #define MAX_QOS                100U
 
+/* State arguments of the self suspend */
+#define PM_STATE_CPU_IDLE              0x0U
+#define PM_STATE_SUSPEND_TO_RAM                0xFU
+
 /*********************************************************************
  * Enum definitions
  ********************************************************************/